<%@page import="实体类.Tuesday"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="static/bootstrap-3.3.7-dist/css/bootstrap.css"/>
</head>
<body>
	<% 	ArrayList<Tuesday> list = (ArrayList<Tuesday>)request.getAttribute("list");	%>
 		<a href="<%=request.getContextPath()%>/Tuesday_insert.jsp?method=insert" class="btn btn-success">添加</a>
 		<table class="table table-striped table-bordered table-hover table-condensed">
			<tr>
				<th>ID</th>
				<th>名字</th>
				<th>学费</th>
				<th>上课时间</th>
				<th>下课时间</th>
				<th>删除</th> 
				<th>修改</th> 
			</tr>
			<%
			    for (Tuesday tuesday : list) {
			%>
			    	<tr>
						<td><%=tuesday.getId()%></td>
						<td><%=tuesday.getName()%></td>
						<td><%=tuesday.getMoney()%></td>
						<td><%=tuesday.getBegin()%></td>
						<td><%=tuesday.getEnd()%></td>
						<td><a href= "javascript:deleteById(<%=tuesday.getId() %>)">删除</a></td>
						<td><a href= "<%=request.getContextPath()%>/Tuesday?method=selectById&id=<%=tuesday.getId() %>">修改</a></td>
					</tr>
			<%
			    }
			%>
		</table>
		<script type="text/javascript">
			function deleteById(id){
				var isDelete = confirm('您确认要删除么？');
				if(isDelete){
					location.href = '<%=request.getContextPath()%>/Tuesday?method=deleteById&id=' + id;
				}
			}
		</script>
</body>
</html>